﻿using Inovout;
using Inovout.Data.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KuaJing.Security.Domain
{
    public partial class Resource : TreeDataObject<Resource>
    {
        public Resource()
        { 
        }
        public Resource(Resource parent)
        {
            this.Parent = parent;
        }
        public override ISet<Resource> Children { get { return base.Children; }}
        public override Resource Parent { get; set; }
      

        public virtual string Name { get; set; }
        public virtual string Title { get; set; }


        public override bool Equals(DataObject that)
        {
            Resource resource = that as Resource;
            if (resource.Name.ToLower().TrimEnd('/')== this.Name.ToLower().TrimEnd('/'))
            {
                return true;
            }
            return false;
        }

        public override int GetHashCode()
        {
            //HashCodeCombiner hashCodeCombiner = new HashCodeCombiner();
           // hashCodeCombiner.Add(this.Name);
            int hashCode = this.Name.GetHashCode();
            return hashCode;
        }
    }
}
